<?xml version="1.0" encoding="utf-8"?>
<modification>
    <name>Abandoned Carts</name>
    <code>abandoned_carts_ocv129</code>
    <description>Reach out to prospects with bailed carts; gain valuable insight to usability and recover lost sales.</description>
    <version>1.2.9</version>
    <author>Angela</author>
    <link>https://github.com/angela-d</link>

    <file path="admin/controller/common/header.php">
      <operation error="skip" info="Language call for the abandoned carts menu link.">
          <search ><![CDATA[
            $data['text_order'] = $this->language->get('text_order');
            ]]></search>
          <add position="after"><![CDATA[
            $data['text_bailed_carts'] = $this->language->get('text_bailed_carts');
          ]]></add>
      </operation>
        <operation error="skip" info="Model inclusion for abandoned carts.">
            <search ><![CDATA[
              $this->load->model('sale/order');
              ]]></search>
            <add position="after"><![CDATA[
              $this->load->model('extension/module/abandoned_carts');

        			// Bailed Carts
              $bailed_carts_total         = ($this->config->get('abandoned_carts_status') == '1') ? $this->model_extension_module_abandoned_carts->getTotalOrders() : '0';
        			$data['bailed_carts_total'] = $bailed_carts_total;
        			$data['bailed_carts']       = $this->url->link('report/abandoned_carts', 'token=' . $this->session->data['token'], true);
            ]]></add>
        </operation>
        <operation error="skip" info="Alert total, with any bailed carts summed.">
            <search ><![CDATA[
              $data['alerts'] = $customer_total + $product_total + $review_total + $return_total + $affiliate_total;
              ]]></search>
            <add position="after"><![CDATA[
              $data['alerts'] = $customer_total + $product_total + $bailed_carts_total + $review_total + $return_total + $affiliate_total;
            ]]></add>
        </operation>
    </file>

    <file path="admin/language/en-gb/common/header.php">
        <operation error="skip" info="English language definition for bailed carts menu entry.">
            <search ><![CDATA[
              $_['text_order']             = 'Orders';
              ]]></search>
            <add position="after"><![CDATA[
              $_['text_bailed_carts']      = 'Bailed Carts';
            ]]></add>
        </operation>
    </file>

    <file path="admin/language/ar/common/header.php">
        <operation error="skip" info="Arabic language definition for bailed carts menu entry.">
            <search ><![CDATA[
              $_['text_order']             = 'الطلبات';
              ]]></search>
            <add position="after"><![CDATA[
              $_['text_bailed_carts']      = 'السلات المهجورة';
            ]]></add>
        </operation>
    </file>

    <file path="admin/language/pt-br/common/header.php">
        <operation error="skip" info="Brazilian Portugese language definition for bailed carts menu entry.">
            <search ><![CDATA[
              $_['text_order']             = 'Encomendas';
              ]]></search>
            <add position="after"><![CDATA[
              $_['text_bailed_carts']      = 'Carrinhos abandonados;
            ]]></add>
        </operation>
    </file>

    <file path="admin/language/pt-pt/common/header.php">
        <operation error="skip" info="Portugese language definition for bailed carts menu entry.">
            <search ><![CDATA[
              $_['text_order']             = 'Encomendas';
              ]]></search>
            <add position="after"><![CDATA[
              $_['text_bailed_carts']      = 'Carrinhos abandonados;
            ]]></add>
        </operation>
    </file>

    <file path="admin/view/template/common/header.tpl">
        <operation error="skip" info="Adds a link in header alerts to bailed carts breakdown.">
            <search ><![CDATA[
              <li class="dropdown-header"><?php echo $text_order; ?></li>
              ]]></search>
            <add position="after"><![CDATA[
              <?php if (isset($bailed_carts_total) && $bailed_carts_total >0) { ?>
                <li class="divider"></li>
                <li><a href="<?php echo $bailed_carts; ?>" style="display: block; overflow: auto;"><span class="label label-danger pull-right"><?php echo $bailed_carts_total; ?></span><?php echo $text_bailed_carts; ?></a></li>
              <?php } ?>
            ]]></add>
        </operation>
    </file>
</modification>
